#!/bin/bash
cd ~/wars
if [[  -z "$1" ]]; then
	echo " service name is required"
	exit -1
fi
if [[ ! -f "$1.war" ]]; then
	echo " $1.war is not found"
	exit -1
fi
echo "stop $1"
service $1 stop
echo "remove war $1"
rm -rf /usr/bx_app/program/$1/webapps/$1
echo "unzip $1 to /usr/bx_app/program/$1/webapps/"
unzip -q bec-user.war -d /usr/bx_app/program/$1/webapps/$1
rm -f /var/log/logs/$1/*
echo "start $1"
service $1 start